import os
from celery import Celery

# Configure Celery using environment variables
broker_url = os.environ.get("CELERY_BROKER_URL", "redis://redis:6379/0")
result_backend = os.environ.get("CELERY_RESULT_BACKEND", "redis://redis:6379/0")

celery = Celery(
    "tasks",
    broker=broker_url,
    backend=result_backend,
    include=['app.tasks']  # Changed to include app.tasks
)

if __name__ == "__main__":
    celery.start()